package com.yunhe.authority.domain.company;

import java.util.ArrayList;
import java.util.List;

/**
 * 企业树形对象
 * @author liuronglei
 */
public class CompanyTree implements Comparable<CompanyTree> {

    private Long id;
    private Long code;
    private String type;
    private String title;
    private Object object;
    private Integer level;
    private List<CompanyTree> children;

    @Override
    public int compareTo(CompanyTree o) {
        if (o == null) {
            return 1;
        }
        return this.getLevel().compareTo(o.getLevel());
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getCode() {
        return code;
    }

    public void setCode(Long code) {
        this.code = code;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }

    public List<CompanyTree> getChildren() {
        return children;
    }

    public void addChild(CompanyTree deviceTree) {
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        this.children.add(deviceTree);
    }

    public void setChildren(List<CompanyTree> children) {
        this.children = children;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }
}
